<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <!--<meta http-equiv="Cache-Control" content="no-siteapp"/>-->
    <link rel="Bookmark" href="imgs/bai.ico"/>
    <link rel="Shortcut Icon" href="imgs/bai.ico"/>
    <title>场景选择</title>
    <link rel="stylesheet" type="text/css" href="css/scence.css"/>
    <style type="text/css">
    </style>
</head>
<body>
    <!--header-->
    <div id="header">想用哪个场景哈</div>

    <!--视频列表-->
    <div id="boxList"></div>
    <!--分页-->
    <!--<div id="pageHtml">-->
        <!--<a href="">首页</a>-->
        <!--<span id="pageStr">（1/2）</span>-->
        <!--<a href="javascript:;" onclick="getVideoList();">下一页</a>-->
    <!--</div>-->

    <!--APP弹窗-->
    <span id="appPop"></span>
    <!--信息弹窗-->
    <span id="msgPop"></span>
</body>
</html>


<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/view.js"></script>
<!--<script type="text/javascript" src="js/scene.js"></script>-->
<script type="text/javascript">
    var cw = document.documentElement.clientWidth;
    var ch = document.documentElement.clientHeight;
    var pages = {
        start: 1, limit: pageSize,
    };
    var code = getParamByUrl('code');
    var h5code = getParamByUrl('h5code');
    console.log(cw, ch);
    (function(){
        $('.boxOne').css('width', cw*0.5-2);
        sceneList();
    })();
    //场景列表
    function sceneList(){
        var formData = {
            start: pages.start,
            limit: pages.limit,
        };
        $.ajax({
            type: apis.sceneIndex.method,
            url: apis.sceneIndex.url,
            data: formData,
            success: function (res) {
                console.log(res);
                if (res.code != 0) {
                    console.log(res.msg);
                }
                var h = sceneHtml(res.data);
                $('#boxList').html(h);
            },
            error: function () {
                console.log('网络错误');
            }
        });
    }
    //拼接字符串
    function sceneHtml(d){
        var h = '', i, vid, thumb, title;
        for (i = 0; i < d.length; i ++) {
            vid = d[i].id;
            thumb = d[i].thumb;
            title = d[i].title;
            h += '<div class="boxOne" style="width: ' + (cw * 0.5 - 2) + 'px; height: ' + (cw * 0.5 * 1.7) + 'px; background: #fff;" onclick="toCnt(' + vid + ');">';
            if (thumb == '') {
                h += '';
            } else {
                h += '<img src="/' + thumb + '" style="width: ' + (cw / 2 -2) + 'px; height: ' + (cw / 2 * 1.7) + 'px;"/>';
            }
//            h += '<div class="menu" style="left: ' + (cw * 0.5 - 40) + 'px;">';
//            h += '<div><img src="/h5/imgs/mpPlay.png"/></div>';
//            h += '<div>0</div>';
//            h += '</div>';
            h += '<div class="boxTitle">' + title + '</div>';
            h += '</div>';
        }
        return h;
    }
    //去内容列表
    function toCnt(v){
        var p = '/h5/scene-cnt.html';
        p += '?scene_id=' + v;
        p += '&code=' + code;
        p += '&h5code=' + h5code;
        window.location.href = p;
    }
</script>